<?php
class News extends Node_content {
    //private $node_type = 'article';
    
    public function init() {
        $this->set_node_type('news');
    }
    
    
    public function edit_content($node_id) {
        $data = $_POST;
        return $this->model('news')->edit_content($node_id, $data);
    }
    
    public function get_content($node_id) {
        return $this->model('news')->get_content($node_id);
    }
    
    public function remove_content($node_id) {
        return $this->model('news')->remove_content($node_id);
    }
    
    public function block_display_content($node_id) {
        return $this->view('node/news_display', $this->get_content($node_id));
    }
    
    public function block_list($page_length = 5, $has_description = true) {
        $page_index = (int) tos_http_get('page');
        //$page_length = 11;
        $offset = ($page_index > 0) ? ($page_index - 1) * $page_length : 0;
        
        $news_list = $this->model('news')->get_list($offset, $page_length);
        
        return $this->view('news/list', array('news_list' =>$news_list, 'has_description' => $has_description));
    }
}
?>